/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ez2find.util;

import java.util.Map;
import javax.faces.context.FacesContext;

/**
 *
 * @author Administrador
 */
public class SessionContext {

    /** Creates a new instance of SessionContext */
    public SessionContext() {
    }
    
    
    public static void setAttribute(String name, Object value){
        getSession().put(name, value);
    }
    
    
    public static Object getAttribute(String name){
        Map<String, Object> map=getSession();
        if (! map.containsKey(name)){
            return null;
        }
        return map.get(name);
    }
    
    public static void removeAttribute(String name){
        getSession().remove(name);
    }
    
    private static Map<String, Object> getSession(){
     return FacesContext.getCurrentInstance().getExternalContext().getSessionMap();   
    }
}